package com.cn.wanxi.servlet;

import com.cn.wanxi.model.CompanyModel;
import com.cn.wanxi.model.NavModel;
import com.cn.wanxi.service.CompanyService;
import com.cn.wanxi.service.NavService;
import com.cn.wanxi.service.impl.CompanyServiceImpl;
import com.cn.wanxi.service.impl.NavServiceImpl;

import javax.servlet.http.HttpServletRequest;

class CommonServlet {
    static void setReq(HttpServletRequest req) {
        CompanyService companyService = new CompanyServiceImpl();
        CompanyModel companyModel = companyService.getCompanyModel();
        req.setAttribute("companyModel", companyModel);

//        导航信息展示
//        调用导航的服务逻辑层
        NavService navService = new NavServiceImpl();
//        得到导航数据
        NavModel[] navModels = navService.getNavModels();
//        将导航数据传递到前端jsp页面
        req.setAttribute("navModels", navModels);
    }
}
